from impala.dbapi import connect

def create_conn(db_name):
    return connect(host='master', port=10000,database=db_name,auth_mechanism='NOSASL')

def delete_db(conn, db_name):
    cursor = conn.cursor()
    results = cursor.execute('drop database ' + db_name)
    if results is None:
        print('删除数据库'+db_name+'成功，无返回值！')


if __name__ == '__main__':
    db_name = 'default'
    conn = create_conn(db_name)
    delete_db(conn, db_name)